package com.woniuxy.factory.controller;

import com.woniuxy.factory.entity.Order;
import com.woniuxy.factory.entity.ResponseResult;
import com.woniuxy.factory.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

@Controller
public class OrderController {
    @Autowired
    OrderService orderService;

    //查询订单记录
    @ResponseBody
    @GetMapping("/order")
    public ResponseResult<List<Order>> geOrderAll(Integer page,int limit){
        ResponseResult<List<Order>> responseResult=orderService.getOrderAll(page,limit);
        return responseResult;
    }
    //新增订单记录
    @ResponseBody
    @PostMapping("/order")
    public ResponseResult addOrder(Integer client, Date date, String remark, HttpServletRequest request){

        ResponseResult responseResult=orderService.addOrder(client,date,remark,request);
        return responseResult;
    }
}
